
function s(){
    var li = document.querySelectorAll("#ul li");
    var all = document.querySelector("#span9");

    var allnum = 0;

    for (var i = 0;i < li.length;i++){
        var one = li[i].children[0].children[0].children[2].children[0].innerHTML;
        var two = li[i].children[0].children[0].children[3].children[0].value;

        //小计
        var three = li[i].children[0].children[0].children[4].children[0].innerHTML = one * two;

        //总计
        allnum += three;
    }
    all.innerHTML = allnum.toFixed(2);
}
s();
var num = document.querySelectorAll(".wn2 .input");
for(var j = 0;j<num.length;j++){
    num[j].addEventListener('change',s);
}

var del = document.querySelectorAll("#ul .span22");
for (var k = 0; k < del.length; k++){
    del[k].addEventListener('click',function(){
        this.parentNode.parentNode.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode.parentNode.parentNode);
        s()
    });
}